Learning QGIS 2.0 by Unknown

Learning QGIS 2.0 by Unknown

Author:Unknown
Language: eng
Format: epub
Publisher: Packt Publishing


If we want to change attributes of multiple or all features in a layer, editing them manually usually isn't an option. That is what Field Calculator is good for. We can access it using the Open field calculator button in the attribute table or using the Ctrl + I keys. In Field Calculator, we can choose to only update selected features or to update all the features in the layer. Besides updating an existing field, we can also create a new field. The function list is the same one we already explored when we selected features by expression. We can use any of these functions to populate a new field or update an existing one. Here are some example expressions that are used often:

We can create an id column using the $rownum function, which populates a column with the row numbers as shown in the following screenshot

Another common use case is to calculate line length or polygon area using the geometry functions $length and $area respectively

Similarly, we can get point coordinates using $x and $y

If we want to get the start or end points of a line, we can use xat(0) and yat(0) or xat(-1) and yat(-1)



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.